package net.lab1024.sa.admin.module.business.exam.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import net.lab1024.sa.admin.module.business.exam.domain.entity.PaperEntity;
import net.lab1024.sa.admin.module.business.exam.domain.form.add.PaperAddForm;
import net.lab1024.sa.admin.module.business.exam.domain.form.query.PaperQueryForm;
import net.lab1024.sa.admin.module.business.exam.domain.form.update.PaperUpdateForm;
import net.lab1024.sa.admin.module.business.exam.domain.vo.PaperVO;
import net.lab1024.sa.admin.module.business.exam.service.PaperService;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 课程分类 Controller
 *
 * @Author AKITA
 * @Date 2025-06-06 11:28:07
 * @Copyright AKITA
 */

@RestController
@Tag(name = "课程分类")
public class PaperController {

    @Resource
    private PaperService paperService;

    @PostMapping("/paper/queryPage")
    public ResponseDTO<PageResult<PaperVO>> queryPage(@RequestBody @Valid PaperQueryForm queryForm) {
        return ResponseDTO.ok(paperService.queryPage(queryForm));
    }

    @PostMapping("/paper/add")
    public ResponseDTO<Long> add(@RequestBody @Valid PaperAddForm addForm) {
        return paperService.add(addForm);
    }

    @PostMapping("/paper/update")
    public ResponseDTO<String> update(@RequestBody @Valid PaperUpdateForm updateForm) {
        return paperService.update(updateForm);
    }

    @PostMapping("/paper/batchDelete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return paperService.batchDelete(idList);
    }

    @GetMapping("/paper/delete/{docEntry}")
    public ResponseDTO<String> batchDelete(@PathVariable Long docEntry) {
        return paperService.delete(docEntry);
    }

    @GetMapping("/paper/info/{docEntry}")
    public ResponseDTO<PaperEntity> info(@PathVariable Long docEntry) {
        return paperService.info(docEntry);
    }

    @GetMapping("/paper/comTestPaperOk/{docEntry}")
    public ResponseDTO<PaperEntity> comTestPaperOk(@PathVariable Long docEntry) {
        return paperService.comTestPaperOk(docEntry);

    }


}
